#include "visualizadorPilha.h"

//------------------------------------------------------------------------------
visualizadorPilha::visualizadorPilha(float x, float y):visualizadorAbstrato(x,y)
{
	plhPilha = new Pilha;
};
//------------------------------------------------------------------------------
visualizadorPilha::~visualizadorPilha()
{
	delete plhPilha;
	plhPilha = NULL;
};
//------------------------------------------------------------------------------
void visualizadorPilha::desenha(TImage *area,double escalaX,double escalaY)const
{
		area->Canvas->Brush->Color = clOlive;
		area->Canvas->Rectangle((getX())*escalaX,(getY())*escalaY,(getX()+44)*escalaX,(getY()+44)*escalaY);
		if (escalaX == 1)
		{
				area->Canvas->Brush->Color = clWhite;
				area->Canvas->Rectangle((getX()+9)*escalaX,(getY()+15)*escalaY,(getX()+17)*escalaX,(getY()+23)*escalaY);
				area->Canvas->Rectangle((getX()+14)*escalaX,(getY()+7)*escalaY,(getX()+22)*escalaX,(getY()+15)*escalaY);
				area->Canvas->Rectangle((getX()+19)*escalaX,(getY()+15)*escalaY,(getX()+27)*escalaX,(getY()+23)*escalaY);
				//texto
				area->Canvas->Brush->Color = clWhite;
				area->Canvas->TextOutA((getX()+6)*escalaX,(getY()+29)*escalaY,"Pilha" +IntToStr(getIdentidade()));
		}
};
//------------------------------------------------------------------------------
void visualizadorPilha::interage()
{
	TfrmPilha * frmPilha = new TfrmPilha(Application, plhPilha);
	frmPilha->ShowModal();
	delete(frmPilha);
	frmPilha = NULL;
};
//------------------------------------------------------------------------------

